#include "common.utils.hpp"

void test_window()
{
    SDL_Init(INIT_ALL);

    SDL_Window * window = SDL_CreateWindow(CREATEWINDOW); // I want the api more simple
    SDL_Renderer * renderer = SDL_CreateRenderer(CREATERENDERER);


    DELAY(1000);

    SDL_SetRenderDrawColor(renderer, COLORSET(60,c0,a0,ff)); // I want the api more simple

    SDL_RenderDrawLine(renderer, 0, 0, W, H);

    SDL_RenderPresent(renderer);

    DELAY(1000);

    // 创建进度条
    for (int x =200; x < 600; x++)
    {
        SDL_Rect rect = {.x=x, .y=100, .w=100,.h=100};
        SDL_RenderFillRect(renderer, &rect);
        SDL_RenderPresent(renderer);

        DELAY(10);
    }


    for (int x = 0; x < 600; x++)
    {
        SDL_SetRenderDrawColor(renderer, COLORSET(ff,ff,ff,ff));
        SDL_RenderClear(renderer);

        SDL_SetRenderDrawColor(renderer, COLORSET(aa,bb,cc,dd));

        SDL_Rect rect = {.x=x, .y=static_cast<int>(300.0 + 100 * sin(0.03 * x )), .w= 80, .h=100};

        SDL_RenderFillRect(renderer, &rect);

        Present(renderer);

        DELAY(10);
    }

    SDL_Rect rect = {DEFAUTE_RECT};// I want the api more simple

     SDL_RenderDrawRect(DRAWRECT);
    // I want the api more simple

    SDL_RenderFillRect(renderer, &rect);

    Present(renderer);// I want the api more simple

    SDL_DestroyRenderer(renderer);
    DELAY(1000);

    SDL_Quit();
}